<template>
  <div class="adverlist">
    <div
      v-for="item in list[`advert_${this.typeId}`]"
      :key="item.id"
    >
      <div
        class="text-center mb-2"
        v-if="item.setting.choice == 1"
      >
        <a
          class="d-block"
          v-if="item.setting.is_thumb == 1 && item.url.length > 0"
          :href="item.url"
          :title="item.title"
          target="_blank"
        ><img
            class="img-fluid"
            :src="item.loge"
          ></a>
        <a
          class="d-block"
          :title="item.title"
          v-if="item.setting.is_title == 1 && item.url.length > 0"
          :href="item.url"
          target="_blank"
        >{{item.title}}</a>
        <router-link
          class="d-block"
          :title="item.title"
          target="_blank"
          v-if="item.setting.is_thumb == 1 && item.url.length == 0"
          :to="'/advert/'+ item.id"
        ><img
            class="img-fluid"
            :src="item.loge"
          ></router-link>
        <router-link
          class="d-block"
          target="_blank"
          :title="item.title"
          v-if="item.setting.is_title == 1 && item.url.length == 0"
          :to="'/advert/'+ item.id"
        >{{item.title}}</router-link>
      </div>
      <div
        v-else
        v-html="item.content"
      >
      </div>
    </div>
  </div>
</template>
<script>
import { mapState, mapActions } from "vuex";
export default {
  name: 'Advert',
  data () { return {} },
  props: ['typeId'],
  created () {
    this.setList(this.typeId)
  },
  computed: {
    ...mapState({ list: state => state.advert.list })
  },
  methods: {
    ...mapActions("advert", ['setList'])
  }
}
</script>

<style>
.adverlist img {
  max-width: 100%;
}
</style>


